<style type="text/css">
	.image-result-content {
		max-height: 50px;
		overflow: hidden;
		margin-bottom: 5px;
	}
	#image-result,#logo-result {
		max-height: 50px;
	}
</style>
<form action="" class="form-horizontal" role="form">

    <div class="form-group">
        <label class="col-sm-2 control-label">投票标题</label>
        <div class="col-sm-4">
            <input type="text" class="form-control" name="name" placeholder="请输入名称" value="{$wechatActivityVote.name}" />
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">投票说明</label>
        <div class="col-sm-4">
            <textarea name="desc" rows="3" cols="" class="form-control" placeholder="请输入说明" >{$wechatActivityVote.desc}</textarea>
        </div>
    </div>
        
    <div class="form-group">
        <label class="col-sm-2 control-label">投票图片</label>
        <div class="col-sm-4">
            <div class="image-result-content">
                <img id="logo-result" class="margin-bottom" src="{$wechatActivityVote.pic}" />
            </div>
            <input type="text" id="pic" name="pic" class="form-control margin-bottom" value="{$wechatActivityVote.pic}" />
            <input type="file" name="logo_upload" id="logo_upload" />
        </div>
    </div>
    
    <div class="form-group">
        <label class="col-sm-2 control-label">开始时间</label>
        <div class="col-sm-4">
            <input type="text" class="form-control" id="startTime" name="startTime" placeholder="请输入时间" value="<notempty name='wechatActivityVote.startTime'>{$wechatActivityVote.startTime|date='Y-m-d H:i:s',###}</notempty>" />
        </div>
    </div>
    
    <div class="form-group">
        <label class="col-sm-2 control-label">结束时间</label>
        <div class="col-sm-4">
            <input type="text" class="form-control" id="endTime" name="endTime" placeholder="请输入时间" value="<notempty name='wechatActivityVote.endTime'>{$wechatActivityVote.endTime|date='Y-m-d H:i:s',###}</notempty>" />
        </div>
    </div>
    
    <!--<div class="form-group">
        <label class="col-sm-2 control-label">每天投票次数</label>
        <div class="col-sm-4">
            <input type="number" class="form-control" name="timesPerDay" placeholder="请输入次数" value="{$wechatActivityVote.timesPerDay}" />
        </div>
    </div>
    
    <div class="form-group">
        <label class="col-sm-2 control-label">每次投票数量</label>
        <div class="col-sm-4">
            <input type="number" class="form-control" name="countPerVote" placeholder="请输入每次投票数量" value="{$wechatActivityVote.countPerVote}" />
        </div>
    </div>-->
    
    <div class="form-group">
        <label class="col-sm-2 control-label">初始得票数量</label>
        <div class="col-sm-4">
            <input type="number" class="form-control" name="defaultCount" placeholder="请输入初始得票数量" value="{$wechatActivityVote.defaultCount}" />
        </div>
    </div>
    
    <div class="form-group">
        <label class="col-sm-2 control-label">活动规则标题</label>
        <div class="col-sm-4">
            <input type="text" class="form-control" name="ruleTitle" placeholder="请输入标题" value="{$wechatActivityVote.ruleTitle}" />
        </div>
    </div>

    <div class="form-group category-news">
        <label class="col-sm-2 control-label">活动规则内容</label>
        <div class="col-sm-6">
            <script id="game-rule" type="text/plain">{$wechatActivityVote.ruleContent}</script>
        </div>
    </div>

	<div class="form-group">
		<div class="col-sm-offset-2 col-sm-8">
			<input type="hidden" name="id" value="{$wechatActivityVote.id}" /> <a
				class="btn btn-default" onclick="javascript:history.go(-1)">返回上页</a>
			<a class="btn btn-default" onclick="self.location=document.referrer">返回上页并刷新</a>
			<button type="submit" class="btn btn-primary submit"
				data-loading-txt="提交中，请稍后……" data-ajax-url="__CONTROLLER__/save">保存更改</button>
		</div>
	</div>

</form>


<!-- uploadify -->
<link rel="stylesheet" href="__PUBLIC__/Style/Common/uploadify/uploadify.css">
<script type="text/javascript" src="__PUBLIC__/Style/Common/uploadify/jquery.uploadify.min.js?t={:time()}"></script>
<script type="text/javascript">
	$(function() {
	    $("#logo_upload").uploadify({
	        'multi'			:	false,
	        'fileSizeLimit' : 	'200kb',
	        'buttonText'	:	'选择图片',
	        'fileTypeDesc' 	: 	'Image Files',
	        'fileTypeExts' 	: 	'*.jpg; *.png',
	        'swf'			: 	'__PUBLIC__/Style/Common/uploadify/uploadify.swf?{:time()}',
	        'uploader'		: 	'__MODULE__/Upload/uploadOne',
	        'onUploadSuccess'	: function(data, res){
	        	
	        	var url = eval("(" + res + ")").extra.url;
	        	$("#logo-result").attr("src", url);
	        	$("#pic").val( url );
	        	
	        }
	    });
	
	});
</script>

<!-- ueditor -->
<link rel="stylesheet" href="/ue/themes/default/css/ueditor.min.css">
<script type="text/javascript" src="/ue/ueditor.config.js"></script>
<script type="text/javascript" src="/ue/ueditor.all.js"></script>
<script type="text/javascript">
	window.UEDITOR_HOME_URL = "/ue/";
    
    var editor = UE.getEditor("game-rule",{
    	initialFrameWidth: "100%",
	    initialFrameHeight: 300,
	    textarea: "ruleContent"
    });
</script>

<!-- datetimepicker -->
<link rel="stylesheet" href="__PUBLIC__/Style/Common/datetimepicker/bootstrap-datetimepicker.min.css">
<script src="__PUBLIC__/Style/Common/datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script src="__PUBLIC__/Style/Common/datetimepicker/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript">
  $(function(){
    
    $("#startTime").datetimepicker({
      "language": "zh-CN"
    });
    
    $("#endTime").datetimepicker({
      "language": "zh-CN"
    });
  });
</script>
